package com.cqie.rbac.controller;


import com.cqie.rbac.bo.TimeTaleBo;
import com.cqie.rbac.entity.TestTimetable;
import com.cqie.rbac.entity.TimetableView;
import com.cqie.rbac.mapper.TestTimetableMapper;
import com.cqie.rbac.service.ITimetableViewService;
import com.cqie.rbac.util.MyPageHelper;
import com.cqie.rbac.util.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * VIEW 前端控制器
 * </p>
 *
 * @author 单机吧
 * @since 2021-10-12
 */
@Api(tags = "课表管理")
@RestController
@RequestMapping("/timetable")
public class TimetableViewController {

    @Autowired
    private ITimetableViewService iTimetableViewService;

    @Autowired
    private TestTimetableMapper testTimetableMapper;

    @ApiOperation("获取课表信息")
    @PostMapping("/getTimeTableList")
    public Result<PageInfo<TimetableView>> getTimeTableList(TimeTaleBo bo){
        List<TimetableView> timetableViews = iTimetableViewService.getTimeTableList(bo);
        return Result.ok().data(MyPageHelper.returnPage(timetableViews));
    }
    @ApiOperation("插入课表信息")
    @PostMapping("/insert")
    public void insert(TestTimetable testTimetable){
        testTimetableMapper.insert(testTimetable);
    }


}
